var add,edit,$formData = $('#formData');
require(['select2', 'validator','layout'], function() {
	$('form').initForm();
	add = function(fn) {
		var result = $.validator($formData);
		if(result){
			$.ajaxExt({
				url : "/funMaintenaSet/saveOrUptMaintenRmndrSetInfo.htm",
				data : $formData.getValues()
			}).done(function(data){
				fn();
			});
		}
	}
	
	edit = function() {
		var result = $.validator($formData);
		if(result){
			$.ajaxExt({
				url : "/funMaintenaSet/uptMaintenRmndrSetInfo.htm",
				data : $formData.getValues()
			}).done(function(data){
				$.messager.alert("提示","您成功修改了一个维保计划!","success");
				getEditDialog().dialog('close');
				reloadGridData();
			});
		}
	}
	
	setVal = function (rcrdId){
		$.ajaxExt({
			url :"/funMaintenaSet/getMaintenRmndrSetInfo.htm",
			data : {'rcrdId' : rcrdId}
		}).done(function(data){
			$formData.setValues(data);
		});
	}
	reset = function (){
		$formData.reset();
	}
	
})